import {Component} from '@angular/core';
import {Blog} from "./data/Blog";
import {BlogService} from "./data/blog.service";

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  providers:[BlogService]
})
export class AppComponent {
  blogList: Blog[];
  selectedBlog: Blog;

  constructor(private bService: BlogService) {
    this. blogList = bService.getBlogs();
  }
  selectBlog(id:number){
    this.selectedBlog=this.bService.getSelectedBlog(id);
  }
}
